package demo3;
class Student1{
    private String name;
    private String sex;
    private int age;
    private double score;

    public Student1() {
        //构造方法
        System.out.println("构造方法执行了....");
    }

    //实例代码块   实例代码块一般用于 初始化实例成员变量。
    {
        this.name = "bit";
        this.age = 12;
        this.sex = "man";
        System.out.println("实例代码块执行力....");
    }

    public void show(){
        System.out.println("name: "+name+" age: "+age+" sex: "+sex);
    }
}
public class Test {
    public static void main(String[] args) {
        //5.掌握代码块
        /*代码块分为4种
        * 1.普通代码块  (很少见到)
        * 2.构造块(也叫实例代码块)
        * 3.静态块
        * 4.同步代码块*/
        Student1 stu = new Student1();
        stu.show();
    }
}
